<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" id="aid">
<head>
  <meta charset="utf-8">
  <title>参数设置 / 用户计划</title>
  <link rel="stylesheet" href="../../../css/layui.css" media="all">	
  <link rel="stylesheet" type="text/css" href="../../../css/common.css"/>
	<link rel="stylesheet" type="text/css" href="../../../zTree/zTreeStyle/zTreeStyle.css"/>
</head>
<body class="inner-body layui-row layui-col-space10" style="background:#f2f2f2;position: relative; ">
<!-------默认表格开始----------->
<div class="">	 
	<div class="tableHtml" style="height: 100%;background: #FFFFFF; min-width: 800px;">
		<div class="top-btn">
			<div class="layui-btn-group">
				<button class="layui-btn" id="addBtn">新增</button>
				<button class="layui-btn" id="editBtn">编辑</button>
				<button class="layui-btn" id="delBtn">删除</button>
		 	</div>
		 	<div class="search-btn-group layui-form">
				<input type="text"  autocomplete="off" class="layui-input layui-input_" placeholder="请输入用户计划名称" style="width:200px;">
				<div class="layui-input-block" style="display: inline-block; margin-left: 0px;">
					<select name="interest" lay-filter="">
					  <option value="0">状态</option>
					  <option value="1">运行中</option>
					  <option value="2">关闭</option>  
					</select>
				</div>
		 		<button class="layui-btn layui-btns">查询</button>
			</div>
		</div>
		<div class="tableDiv" >
			<table id="layui-table" lay-filter="tableBox" class="layui-table"></table>
		</div>
	</div>
</div>

<!-----------------默认表格结束------------>

</body>
<script type="text/html" id="barDemo">
	{{# if(d.status == "0"){ }}
	<span class="layui-badge-dot ayui-bg-orange"></span><a class="" lay-event="choose">关闭</a>
	{{# } }}
	{{# if(d.status == "1"){ }}
	<span class="layui-badge-dot layui-bg-green"></span><a class="" lay-event="shouquan" style="cursor: pointer;">运行中</a>
	{{# } }}
</script>
	
<script src='../../../layui.all.js'></script>
<script src="../../../js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="../../../zTree/jquery.ztree.all.js" type="text/javascript"></script>
<script src="../../../zTree/jquery.ztree.exhide-3.5.min.js" type="text/javascript"></script>
<script src="../../../zTree/MtrSearchZTree.js" type="text/javascript"></script>
<script type="text/javascript">
//主动加载jquery模块
layui.use(['jquery', 'layer'], function(){
	var $ = layui.jquery //重点处
	,layer = layui.layer;
	table = layui.table;//表格，注意此处table必须是全局变量
	$(".treeDiv").height($('.body-right').height()-4);//树高度
	
	
	var arr = [[ 
	    {type:'checkbox'}
      ,{field: 'doorname', title: '门禁开放计划名称'}
	  ,{field: 'status', title:'状态', toolbar: '#barDemo', width:300}
      
    ]];
	var limitArr =[10,20,30];
	var urls = '../../../tableJson2.js';
	com.tableRender('#layui-table','tableId','full-53',limitArr,urls,arr);//加载表格,注意tableId是自定义的，在表格重载需要！！

    /*-----新增用户计划-----*/
 	$("#addBtn").click(function(){	
	  com.pageOpen("新增门禁开放计划","html/parm-setting/user-plan/add.html",['930px', '500px']);
	})
	
    /*-----编辑-----*/
 	$("#editBtn").click(function(){	
	  com.checkOpen("编辑","html/parm-setting/user-plan/edit.html",['930px', '520px']);
	})
	
	/*-----删除-----*/
	$("#delBtn").click(function(){	
		var checkStatus = table.checkStatus('tableId');//tableId 即为基础参数 id 对应的值
		console.log(checkStatus);
		//勾选一条数据
		if (checkStatus.data.length == 0) {
			parent.layer.open({
				title: '温馨提示'
				, content: '请勾选一条目标数据！'
			});
			return false;
		} 
		parent.layer.confirm('该计划已有人员绑定，需解绑人员', {title:'温馨提示'}, function(index){
		  //do something
		  parent.layer.close(index);
		  window.location.reload();
		});
	});

})	
</script>
</html>